package gas.model;

/***
 * Class for User Preferences.
 * 
 * @author Alfred Tarng
 *
 */
public class Preferences {
    private int proximityValue; // how close you want the station to be.
    private String location = LocationsEnum.LAJOLLA.location(); // how close you want the station to be.
    private int costValue; // how cheap you want the station to be.
    private int roundTripCost; // pricePerGallonRange
    private int waitTolerance; // how long you are willing to wait for desired station.
    
    public Preferences(){
      this.setProximityValue(0);
      this.setCostValue(0);
      this.setroundTripCost(0); //pricePerGallonRange
      this.setWaitTolerance(0);
    }
    public Preferences(int pV,int cV, int roundTripCost, int wT, String loc){
        this.setProximityValue(pV);
        this.setCostValue(cV);
        this.setroundTripCost(roundTripCost);
        this.setWaitTolerance(wT);
        this.setLocation(loc);
    }
    public void setAll(int pV,int cV, String loc, int wT){//int roundTripCost, int wT){
      this.setProximityValue(pV);
      this.setCostValue(cV);
//    this.setroundTripCost(roundTripCost);
      this.setLocation(loc);
      this.setWaitTolerance(wT);
    }
        /*************** ACCESSORS ***********************/
              public void setLocation(String sl){ this.location = sl; }
              public String getLocation(){return location;}
              public void setProximityValue(int proximityValue) { this.proximityValue = proximityValue; }
              public int getProximityValue() { return proximityValue; }
              public void setCostValue(int costValue) { this.costValue = costValue; }
              public int getCostValue() { return costValue; }
              public void setroundTripCost(int roundTripCost) { this.roundTripCost = roundTripCost; }
              public int getroundTripCost() { return roundTripCost; }
              public void setWaitTolerance(int waitTolerance) { this.waitTolerance = waitTolerance; }
              public int getWaitTolerance() { return waitTolerance; }
    
    public String toString(){
      String retString = "\nImportance of proximity: " + proximityValue
                       + "\nImportance of cost: "      + costValue
                       + "\nRound Trip cost: "         + roundTripCost
                       + "\nWait Tolerance: "          + waitTolerance;

      return retString;
    }
    
    public static boolean selfTest(){
      boolean passAll = true;
      Preferences testPrefs = new Preferences();
      
      
      passAll = passAll & testPrefs.getCostValue() == 0;
      testPrefs.setWaitTolerance(5);
      passAll = passAll & (testPrefs.getWaitTolerance() == 5);      
      
      System.out.println(testPrefs.toString());
      
      return passAll;
    }
    public static void main(String[] args){
      selfTest();
    }
    
}
